package org.zero.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author Zero (cnzeropro@qq.com)
 * @date 2021/10/3 16:20
 */
@Component
@PropertySource("classpath:alipay.properties")
@ConfigurationProperties(prefix = "alipay")
public class AlipayProperties {
    /**
     * 网关地址
     */
    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";

    /**
     * 商户 appId
     */
    public static String appId;

    /**
     * 加密方式
     */
    public static String signType = "RSA2";

    /**
     * 支付宝公钥
     */
    public static String publicKey;

    /**
     * 商户私钥
     */
    public static String privateKey;

    /**
     * 服务器异步通知路径
     */
    public static String notifyUrl;

    /**
     * 页面同步跳转通知路径
     */
    public static String returnUrl;

    /**
     * 编码
     */
    public static String charset = "UTF-8";

    /**
     * 返回格式
     */
    public static String format = "json";

    public void setGatewayUrl(String gatewayUrl) {
        AlipayProperties.gatewayUrl = gatewayUrl;
    }

    public void setAppId(String appId) {
        AlipayProperties.appId = appId;
    }

    public void setSignType(String signType) {
        AlipayProperties.signType = signType;
    }

    public void setPublicKey(String publicKey) {
        AlipayProperties.publicKey = publicKey;
    }

    public void setPrivateKey(String privateKey) {
        AlipayProperties.privateKey = privateKey;
    }

    public void setNotifyUrl(String notifyUrl) {
        AlipayProperties.notifyUrl = notifyUrl;
    }

    public void setReturnUrl(String returnUrl) {
        AlipayProperties.returnUrl = returnUrl;
    }

    public void setCharset(String charset) {
        AlipayProperties.charset = charset;
    }

    public void setFormat(String format) {
        AlipayProperties.format = format;
    }
}